﻿using System.Web.Mvc;
using System.Web.Routing;

namespace Web
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("Content/*");
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.IgnoreRoute("{*favicon}", new { favicon = @"(.*/)?favicon.ico(/.*)?" });
            routes.MapRoute("Home", "", new { controller = "Home", action = "Index", id = UrlParameter.Optional },
                namespaces: new string[] { "Web.Controllers" });

            routes.MapRoute(
              name: "AuthorIndex",
              url: "Authors/Show/{authorId}",
              defaults: new { controller = "Authors", action = "Show", authorId = UrlParameter.Optional },
              namespaces: new string[] { "Web.Controllers" });

            routes.MapRoute(
             name: "BooksTemplate",
             url: "Books/IndexTemplate",
             defaults: new { controller = "Books", action = "IndexTemplate" },
             namespaces: new string[] { "Web.Controllers" });

            routes.MapRoute(
              name: "BooksIndex",
              url: "Books/{bookId}",
              defaults: new { controller = "Books", action = "Index", bookId = UrlParameter.Optional },
              namespaces: new string[] { "Web.Controllers" });

            routes.MapRoute(
             name: "CategoriesTemplate",
             url: "Categories/IndexTemplate",
             defaults: new { controller = "Categories", action = "IndexTemplate" },
             namespaces: new string[] { "Web.Controllers" });

            routes.MapRoute(
             name: "CategoriesListingTemplateIconView",
             url: "Categories/ListingTemplateIconView",
             defaults: new { controller = "Categories", action = "ListingTemplateIconView" },
             namespaces: new string[] { "Web.Controllers" });

            routes.MapRoute(
             name: "CategoriesListingTemplateListView",
             url: "Categories/ListingTemplateListView",
             defaults: new { controller = "Categories", action = "ListingTemplateListView" },
             namespaces: new string[] { "Web.Controllers" });

            routes.MapRoute(
             name: "CategoriesListing",
             url: "Categories/Listing/",
             defaults: new { controller = "Categories", action = "Listing" },
             namespaces: new string[] { "Web.Controllers" });

            routes.MapRoute(
                name: "FriendsListing",
                url: "Friends/FriendsListing/{userName}",
                defaults: new { controller = "Friends", action = "FriendsListing", userName= UrlParameter.Optional },
                namespaces: new string[] { "Web.Controllers" });

            routes.MapRoute(
                name: "CategoriesNavigationTemplate",
                url: "Categories/NavigationTemplate",
                defaults: new { controller = "Categories", action = "NavigationTemplate" },
                namespaces: new string[] { "Web.Controllers" });

            routes.MapRoute(
               name: "CategoriesNavigation",
               url: "Categories/Navigation",
               defaults: new { controller = "Categories", action = "Navigation" },
               namespaces: new string[] { "Web.Controllers" });

            routes.MapRoute(
              name: "CategoriesAlphabet",
              url: "Categories/AlphabetTemplate",
              defaults: new { controller = "Categories", action = "AlphabetTemplate" },
              namespaces: new string[] { "Web.Controllers" });


            routes.MapRoute(
             name: "CategoriesIndex",
             url: "Categories/{categoryId}",
             defaults: new { controller = "Categories", action = "Index", categoryId = UrlParameter.Optional },
             namespaces: new string[] { "Web.Controllers" });

            routes.MapRoute(
             name: "ProfileShow",
             url: "Profile/Show/{login}",
             defaults: new { controller = "Profile", action = "Show", login = UrlParameter.Optional },
             namespaces: new string[] { "Web.Controllers" });

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index2222", id = UrlParameter.Optional },
                namespaces: new string[] { "Web.Controllers" });
        }
    }
}